
DROP TABLE IF EXISTS `departments`;
CREATE TABLE `departments` (
  `department_id` int(11) NOT NULL AUTO_INCREMENT,
  `department` varchar(300) NOT NULL,
  PRIMARY KEY (`department_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 comment '科室表';

-- ----------------------------
-- Records of departments
-- ----------------------------
BEGIN;
INSERT INTO `departments` VALUES (7, '内科');
INSERT INTO `departments` VALUES (8, '外科');
COMMIT;

DROP TABLE IF EXISTS `doctor`;
CREATE TABLE `doctor` (
  `doctor_id` int(11) NOT NULL AUTO_INCREMENT,
  `doctor_name` varchar(300) NOT NULL,
  `department_id` int(11) NOT NULL,
  `registered_id` int(11) NOT NULL,
  `dstate` int(11) DEFAULT NULL,
  `am_Start_Time` varchar(10) DEFAULT '8:00',
  `am_End_Time` varchar(10) DEFAULT '12:00',
  `pm_Start_Time` varchar(10) DEFAULT '14:00',
  `pm_End_Time` varchar(10) DEFAULT '18:00',
  PRIMARY KEY (`doctor_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 comment '医生表';

-- ----------------------------
-- Records of doctor
-- ----------------------------
BEGIN;
INSERT INTO `doctor` VALUES (13, '华佗', 7, 5, 0, '8:00', '12:00', '14:00', '18:00');
INSERT INTO `doctor` VALUES (14, '扁鹊', 7, 6, 0, '8:00', '12:00', '14:00', '18:00');
INSERT INTO `doctor` VALUES (15, '张春明', 7, 5, 1, '8:00', '12:00', '14:00', '18:00');
INSERT INTO `doctor` VALUES (16, '王二', 8, 5, 1, '8:00', '12:00', '14:00', '18:00');
COMMIT;


-- ----------------------------
-- Table structure for home

DROP TABLE IF EXISTS `paiban`;
CREATE TABLE `paiban` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `one` varchar(50) DEFAULT '无班',
  `two` varchar(50) DEFAULT '无班',
  `three` varchar(50) DEFAULT '无班',
  `four` varchar(50) DEFAULT '无班',
  `five` varchar(50) DEFAULT '无班',
  `six` varchar(50) DEFAULT '无班',
  `seven` varchar(50) DEFAULT '无班',
  `doctor_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 comment '排班表';

-- ----------------------------
-- Records of paiban
-- ----------------------------
INSERT INTO `paiban` VALUES ('12', '有班', '有班', '有班', '有班', '有班', '有班', '有班', '16');
INSERT INTO `paiban` VALUES ('13', '有班', '有班', '有班', '有班', '有班', '有班', '有班', '15');
INSERT INTO `paiban` VALUES ('14', '有班', '有班', '有班', '有班', '有班', '有班', '有班', '14');
INSERT INTO `paiban` VALUES ('15', '有班', '有班', '有班', '无班', '有班', '有班', '有班', '13');

DROP TABLE IF EXISTS `registered_type`;
CREATE TABLE `registered_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(300) NOT NULL,
  `price` double NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 comment '挂号类型表';

-- ----------------------------
-- Records of registeredtype
-- ----------------------------
BEGIN;
INSERT INTO `registered_type` VALUES (5, '普通挂号', 20);
INSERT INTO `registered_type` VALUES (6, '专家号', 30);
COMMIT;

DROP TABLE IF EXISTS `register`;
CREATE TABLE `register` (
  `register_id` int(11) NOT NULL AUTO_INCREMENT,
  `register_name` varchar(100) DEFAULT NULL,
  `sex` varchar(10) DEFAULT NULL,
  `age` int(11) DEFAULT NULL,
  `department_id` int(11) DEFAULT NULL,
  `doctor_id` int(11) DEFAULT NULL,
  `register_type_id` int(11) DEFAULT NULL,
  `price` double DEFAULT NULL,
  `time` datetime DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `state` int(11) DEFAULT NULL,
  `phone` varchar(100) NOT NULL,
  `carid` varchar(100) NOT NULL,
  `zhuan` varchar(500) DEFAULT NULL,
  PRIMARY KEY (`register_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 comment'挂号信息表';

-- ----------------------------
-- Records of report
-- ----------------------------
BEGIN;
INSERT INTO `register` VALUES (32, 'zhangsan', '男', 90, 7, 13, 5, 20, '2021-02-3 17:17:17', 1, 4, '18192133232', '213132432423131', '病情加重');
INSERT INTO `register` VALUES (33, 'lisi', '男', 11, 7, 13, 5, 20, '2021-02-03 8:21:26', 1, 2, '12112212112', '212212121213232', '感冒');
COMMIT;

DROP TABLE IF EXISTS `unit`;
CREATE TABLE `unit` (
  `unit_id` int(11) NOT NULL AUTO_INCREMENT,
  `unit_name` varchar(50) NOT NULL,
  PRIMARY KEY (`unit_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 comment '单位表';

-- ----------------------------
-- Records of unit
-- ----------------------------
INSERT INTO `unit` VALUES ('7', '盒');
INSERT INTO `unit` VALUES ('8', '次');
INSERT INTO `unit` VALUES ('9', '袋');


DROP TABLE IF EXISTS `pharmacy`;
CREATE TABLE `pharmacy` (
  `pharmacy_Id` int(11) NOT NULL AUTO_INCREMENT,
  `pharmacy_name` varchar(50) NOT NULL,
  `unit_id` int(11) NOT NULL,
  `selling_price` double NOT NULL,
  `c_id` int(11) NOT NULL comment '药品生产公司编号',
  `type` int(11) NOT NULL,
  `produceDate` date NOT NULL,
  `validDate` date NOT NULL,
  `drugstore_num` int(11) NOT NULL,
  `skullbatch` varchar(200) NOT NULL,
  PRIMARY KEY (`pharmacy_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 comment '处方表';

-- ----------------------------
-- Records of pharmacy
-- ----------------------------
INSERT INTO `pharmacy` VALUES ('11', '板蓝根', '4',  '30', '4', '5', '2019-10-30', '2020-01-04', '58', '20191121');
INSERT INTO `pharmacy` VALUES ('12', '阿莫西林', '4',  '30', '4', '5', '2019-10-25', '2020-02-01', '9', '20191121');


